﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

namespace Maticsoft.Web.wap
{
    public partial class Default : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindAdv();
            BindProduct();
        }

        protected void BindAdv()
        {
            BLL.AdvertPics advBLL = new BLL.AdvertPics();
            DataSet ds = advBLL.GetList("AdvertId=3 and IsActive=1 order by OrderNo asc");
            StringBuilder strBuilder = new StringBuilder();
            if (ds.Tables[0].Rows.Count > 0)
            {
                strBuilder.Append("<div class=\"mui-slider-item mui-slider-item-duplicate\">");
                strBuilder.Append("<a href=\"" + ds.Tables[0].Rows[0]["url"] + "\"><img src=\"/uploadfiles/ads/" + ds.Tables[0].Rows[0]["pic"] + "\"></a>");
                strBuilder.Append("</div>");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    strBuilder.Append("<div class=\"mui-slider-item\">");
                    strBuilder.Append("<a href=\"" + ds.Tables[0].Rows[i]["url"] + "\"><img src=\"/uploadfiles/ads/" + ds.Tables[0].Rows[i]["pic"] + "\"></a>");
                    strBuilder.Append("</div>");
                }
                strBuilder.Append("<div class=\"mui-slider-item mui-slider-item-duplicate\">");
                strBuilder.Append("<a href=\"" + ds.Tables[0].Rows[4]["url"] + "\"><img src=\"/uploadfiles/ads/" + ds.Tables[0].Rows[4]["pic"] + "\"></a>");
                strBuilder.Append("</div>");
            }
            divAd.InnerHtml = strBuilder.ToString();
        }

        protected void BindProduct()
        {
            BLL.Products proBLL = new BLL.Products();
            DataSet ds = proBLL.GetList(4, "IsHot=1 and IsHid=0 and IsActive=1", "orderNo desc");
            Repeater1.DataSource = ds.Tables[0].DefaultView;
            Repeater1.DataBind();
        }
    }
}